package thread;

public class SyncApiDemo {
    public static void main(String[] args) {
        //StringBuffer buffer=new StringBuffer();
        StringBuilder builder=new StringBuilder();
        Thread t1=new Thread(){


        public void run(){
        for(int i=0;i<1000;i++){
            builder.append("abc");
        }
    }
        };
    Thread t2=new Thread(){
            public void run(){
                for(int i=0;i<1000;i++){
                    builder.append("asd");

                }
            }
        };
    t1.start();
    t2.start();

    try{
        Thread.sleep(50);
    }catch(InterruptedException e){
    }
        System.out.println(builder.length());
    }

}
